﻿
using System;

namespace Sripirom.ATS.Core.Logging
{

    /// <summary>
    /// A Trace Source base, log factory
    /// </summary>
    public class Log4NetLogFactory
        : ILoggerFactory
    {
        private static ILogger _logger;
        private string _name;
        public Log4NetLogFactory()
        {
        }
        public Log4NetLogFactory(String name)
        {
            _name = name;
            _logger = new Log4NetAdapter(_name);
        }
        /// <summary>
        /// Create the trace source log
        /// </summary>
        /// <returns>New ILog based on Trace Source infrastructure</returns>
        public ILogger Create()
        {
            if (_logger == null)
                _logger = new Log4NetAdapter(_name);

            return _logger;
        }

    }
}
